<template>
  <div>
    <el-dialog
      width="740px"
      :title="dialogTitle"
      :visible.sync="IfdialogVisible"
      :before-close="tableClose"
    >
      <el-form :inline="true" :model="formInline" class="demo-form-inline">
        <el-form-item label="工艺" prop="workmanship" :rules="[
            { required: true, message: '请输入相关工艺', trigger: 'blur' },
          ]">
          <el-input v-model="formInline.workmanship"></el-input>
        </el-form-item>
        <el-form-item label="负责人" prop="person" :rules="[
            { required: true, message: '请选择工艺负责人', trigger: 'blur' },
          ]">
          <el-select v-model="formInline.person" placeholder="负责人">
            <el-option label="李四" value="lisi"></el-option>
            <el-option label="王五" value="wangwu"></el-option>
          </el-select>
        </el-form-item>
        <el-form-item>
          <el-button type="primary" @click="onSubmit">添加</el-button>
          <el-button @click="closeform()">取 消</el-button>
        </el-form-item>
      </el-form>
    </el-dialog>
  </div>
</template>

<script>
export default {
  name: "craftFrom",
  props:{
    IfdialogVisible:{
      Boolean,
      default: false,
    }
  },
  data() {
    return {
      //表头
      dialogTitle: "添加工艺",
      formInline: {
        workmanship: "",
        person: "",
      },
    };
  },
  methods: {
    onSubmit() {
      console.log("submit!");
    },
    // 关闭弹窗
    tableClose() {
      this.$confirm("确认关闭？")
        .then(() => {
          this.closeform();
          location.reload();
        })
        .catch(() => {});
    },
    // 关闭编辑表单弹窗
    closeform() {
      this.$emit("closeDialog");
    },
  },
};
</script>

<style>
</style>